package com.eda.common;

import java.util.HashMap;
import java.util.List;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;

public class ListAdapter extends BaseAdapter {
    public static HashMap<Integer, Boolean> isSelected;
    private Context context = null;
    private LayoutInflater inflater = null;
    private List<HashMap<String, Object>> list = null;
    private String keyString[] = null;
    private String itemString = null; // 记录每个item中textview的值
    private int idValue[] = null;// id值

    public ListAdapter(Context context, List<HashMap<String, Object>> list,int resource) {
            this.context = context;
            this.list = list;
           inflater = LayoutInflater.from(context);
            init();
    }

    // 初始化 设置所有checkbox都为未选择
    public void init() {
            isSelected = new HashMap<Integer, Boolean>();
            for (int i = 0; i < list.size(); i++) {
                    isSelected.put(i, false);
            }
    }

    @Override
    public int getCount() {
            return list.size();
    }

    @Override
    public Object getItem(int arg0) {
            return list.get(arg0);
    }

    @Override
    public long getItemId(int arg0) {
            return 0;
    }

    @Override
    public View getView(int position, View view, ViewGroup arg2) {
            return view;
    }

}
